Help. Want to auto-send an email "from" this other account.
string gl_Ole_AppOutlook = "Outlook.Application" // Windows recognizes this as a running Outlook
bool fOle_OK(string in_ResultFromOleCommand, in_NameOfOleCommand)
{
if (!null in_ResultFromOleCommand)
{ print "XX OLE Error:\t" in_NameOfOleCommand "\t[" in_ResultFromOleCommand "]\n"
return(false)
}
else return(true)
}
//******************************
bool fEmail_Outlook_CreateMail(bool in_AutoSend, string in_SendTo, in_SendCC,
in_SendBCC, in_SentFrom, in_Subject, in_Body)
{ // Create the Email message which requires that Outlook.exe is running.
// in_SendTo, in_SendCC, in_SendBCC, and in_SentFrom should be valid
// Email addresses separated by semi-colons;.
// Send the Message when in_AutoSend, otherwise just display it.
// When in_SentFrom is null then no such field is used
bool Result = false
OleAutoObj oaoMessage = null
OleAutoObj oaoOutlook = oleGetAutoObject(gl_Ole_AppOutlook)
if (null oaoOutlook)
{ fOle_OK("Outlook not running", "GetOutlook") // Log Error
return(false)
}
OleAutoArgs autoArgs = create()
clear(autoArgs)
put(autoArgs, 0) // 0 is Outlook's symbolic constant for mail item
if( fOle_OK(oleMethod(oaoOutlook, "CreateItem", autoArgs, oaoMessage), "CreateItem") and
fOle_OK(olePut(oaoMessage, "To", in_SendTo), "To") and
fOle_OK(olePut(oaoMessage, "CC", in_SendCC), "CC") and
fOle_OK(olePut(oaoMessage, "BCC", in_SendBCC), "BCC") and
fOle_OK(olePut(oaoMessage, "Subject", in_Subject), "Subj") and
fOle_OK(olePut(oaoMessage, "Body", in_Body), "Body") and
(null in_SentFrom or
fOle_OK(olePut(oaoMessage, "SentOnBehalfOfName", in_SentFrom), "SentFrom")
)
)
{ // Message created OK. Send or just Show it
if (in_AutoSend)
Result = fOle_OK(oleMethod(oaoMessage, "Send"), "Send")
else Result = fOle_OK(oleMethod(oaoMessage, "Display"), "Display")
}
else Result = false
delete(autoArgs)
return(Result)
} // end fEmail_Outlook_CreateMail()
string ToField = "Louie.Landale@ngc.com"
string SentFrom = "MyDoorsAdmin@ngcXX.com"
bool SendIt = confirm("Confirm to Send; Cancel to Display")
fEmail_Outlook_CreateMail(SendIt, ToField, "", "", SentFrom , "Subject", "Body")
llandale - Tue Feb 08 10:42:57 EST 2011 |
Re: fEmail_Outlook_CreateMail SentFrom Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: fEmail_Outlook_CreateMail SentFrom Mathias Mamsch - Tue Feb 08 12:12:48 EST 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS So in practice the calling function will add the From field also to the BCC field, so the DOORS admin account actually gets the message I sent and has some record of it. Thanks.
|
Re: fEmail_Outlook_CreateMail SentFrom llandale - Wed Feb 09 09:26:17 EST 2011
I just tried the code above but get the following OLE error: CreateItem |
Re: fEmail_Outlook_CreateMail SentFrom llandale - Wed Feb 09 09:26:17 EST 2011
I just tried the code above but get the following OLE error: CreateItem any thoughts? Thanks |
Re: fEmail_Outlook_CreateMail SentFrom Stig0498 - Tue Feb 22 09:35:48 EST 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: fEmail_Outlook_CreateMail SentFrom Mathias Mamsch - Tue Feb 22 10:51:43 EST 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS I am using Outlook 2003 just realised i have missed out the following lines of code clear(autoArgs) put(autoArgs, 0) This stops the error but DOORS just now hangs when I run it |
Re: fEmail_Outlook_CreateMail SentFrom Stig0498 - Wed Feb 23 10:10:53 EST 2011 |
Re: fEmail_Outlook_CreateMail SentFrom Is there a possibility to send an email to multiple groups? I'm used to do it with the sendEmailNotification function, using the Skip list |
Re: fEmail_Outlook_CreateMail SentFrom SystemAdmin - Wed Feb 15 08:49:31 EST 2012 Maybe this works:
string MakeDelimitedList(Skip in_skp, string in_Delim)
{ // Turn the Skip into a delimited list
// Skip's "Key" must be type "string"
if (null in_skp) return("")
Buffer buf = create
string Data, Key
string Delim = ""
for Data in in_skp do
{ Key = (string key in_skp)
buf += Delim
buf += Key
Delim = in_Delim // get ready for next entry
}
string Results = stringOf(buf)
delete(buf)
return(Results)
} // end MakeDelimitedList()
// I suppose you would do this:
string ToField = MakeDelimitedList(skpMyEmailGroups, "; ")
|
Re: fEmail_Outlook_CreateMail SentFrom llandale - Wed Feb 15 11:43:24 EST 2012 Maybe this works:
string MakeDelimitedList(Skip in_skp, string in_Delim)
{ // Turn the Skip into a delimited list
// Skip's "Key" must be type "string"
if (null in_skp) return("")
Buffer buf = create
string Data, Key
string Delim = ""
for Data in in_skp do
{ Key = (string key in_skp)
buf += Delim
buf += Key
Delim = in_Delim // get ready for next entry
}
string Results = stringOf(buf)
delete(buf)
return(Results)
} // end MakeDelimitedList()
// I suppose you would do this:
string ToField = MakeDelimitedList(skpMyEmailGroups, "; ")
Can you please let me know how to add the recipient email address in Cc Field in the script. Moreover it would be great if the particular mail has to be sent automatically in particular time.is that possible? Thanks, Shri |
Re: fEmail_Outlook_CreateMail SentFrom SystemAdmin - Thu Apr 04 05:31:32 EDT 2013 I'm going to try this also, I want to thank you a head of time. Johnny |
Re: fEmail_Outlook_CreateMail SentFrom BuddyD - Mon Apr 15 16:42:35 EDT 2013 I'm going to try this also, I want to thank you a head of time. Johnny Still in clean up of code mode, I'm using Outlook 2007. I think I'm missing some code that is not included above. sbhupa do you have your code working. Is thier a missing piece. Attachments IBMDXLSend.dxl |